<?php
/**
 * 批量创建文件夹
 */
include '../../common.inc.php';
require './auto.func.php';
$table    = 'xd_auto_model';
$db = new DbMysqli();
$maxId = $db->getVar('select max(amid) as maxid from ' . $table, 'maxid');
if (!isset($id)) {
	$id = 19452;
} else {
	if ($id >= $maxId) {
		die(date('Y-m-d H:i:s'));
	}
}
$sql     = "select * from {$table} where amid > $id and status !=0 order by amid asc limit 50 ";

$all = $db->getAll($sql);

var_dump(Env::nquri());
$carFolders = array();
foreach ($all as $r) {
	$carFolder = AutoImport::carFolderByInfo($r);
//	$carFolders[] = $carFolder . '/公共属性';
	$folderUtf8 = getCarFolder($r['arcid'], '').'/'.$r['name'];
//	var_dump($folderUtf8);exit();
	var_dump($folderUtf8);
	$folder = 'D:/folder'.iconv('utf-8', 'gbk', $folderUtf8);
	mkZhFolder($folder);
	$id = $r['amid'];
}

echo '<meta http-equiv="refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&debug=xddl" />';